//
//  AboutTableViewController.m
//  bitcoin
//
//  Created by caiyajun on 2018/5/9.
//  Copyright © 2018年 比特币. All rights reserved.
//

#import "AboutTableViewController.h"
#import "NextGradeView.h"
@interface AboutTableViewController ()
@property (weak, nonatomic) IBOutlet UIButton *sureButton;

@end

@implementation AboutTableViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    UIBarButtonItem *back = [[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:@"arrowleft-icon"] style:UIBarButtonItemStylePlain target:self action:@selector(backAction:)];
    self.navigationItem.leftBarButtonItem = back;
    
    [self.sureButton setBackgroundImage:[UIImage imageWithColor:RGBColor(86, 54, 157)] forState:(UIControlStateHighlighted)];
}


- (void)backAction:(UIBarButtonItem *)sender {
    [self.navigationController popViewControllerAnimated:YES];
}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

#pragma mark - Table view data source

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
    
    return 1;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    
    return 2;
}

-(void)tableView:(UITableView*)tableView didSelectRowAtIndexPath:(NSIndexPath*)indexPath{
    if (indexPath.row==0) {
        [self performSegueWithIdentifier:@"editionSegue" sender:nil];
    }else if (indexPath.row==1){
        [self performSegueWithIdentifier:@"ideaFeedbackSegue" sender:nil];
    }
}
- (IBAction)updateAction {
    self.tableView.userInteractionEnabled = NO;
    NextGradeView *nextGradeView = [NextGradeView xib];
    [[UIApplication sharedApplication].keyWindow addSubview:nextGradeView];
    __weak typeof(nextGradeView) weakNextGradeView = nextGradeView;
    nextGradeView.editionLabel.text=@"V 1.0.0";
    nextGradeView.contentLabel.text=@"1.我的页面功能调整\n2.首页部分样式更改\n3.优化整体页面体验\n4.修复一些崩溃问题\n5.等等";
    nextGradeView.updateActionBlock = ^(NSInteger tag) {
        [weakNextGradeView removeFromSuperview];
        self.tableView.userInteractionEnabled = YES;
    };
    nextGradeView.backActionBlock = ^(NSInteger tag) {
        [weakNextGradeView removeFromSuperview];
        self.tableView.userInteractionEnabled = YES;
    };
}

@end
